package org.nmgyjt.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.nmgyjt.springboot.entity.admin.CsBusiness;

import java.util.List;

public interface CsBusinessMapper extends BaseMapper<CsBusiness> {

    @Select(" select   a.name ,a.business_id,a.ud_order from t_cs_business a where a.parent_id !='0'   ORDER BY a.ud_order ")
    List<CsBusiness> businessAllList();

    @Select(" select * from t_cs_business a where business_id = #{businessId} limit 0,1 ")
    CsBusiness findByBusinessId(@Param("businessId") String businessId);
    @Select("SELECT b.*  from  t_cs_business b ,  t_cs_business_user u  where b.business_id = u.business_id and u.phone = #{phone}  ")
    List<CsBusiness> findByPone(@Param("phone")String phone);

    @Select("SELECT b.*  from  t_cs_business b ,  t_cs_business_user u " +
            " where b.business_id = u.business_id " +
            " and b.parent_id = u.parent_business_id " +
            " and u.phone = #{phone} and b.auth_code !='' ")
    List<CsBusiness> findByPoneOrCodeNot(String authPhone);
}
